package JVM.chapter04;

import java.util.Stack;

public class StackTest {

    public void testA(){
        int i = 2 ;
        int j = 3 ;
        testB();
    }

    public void testB(){
        int a = 5;
        int b = 10;
    }

    public static void main(String[] args) {
        Stack<String> stringStack = new Stack<>();
        stringStack.push("a");
        stringStack.add("b");
        stringStack.forEach(s -> System.out.println(s));

        stringStack.pop();  //将栈顶元素弹出
        stringStack.forEach(s -> System.out.println(s));

        System.out.println("检测栈是否为空" + stringStack.empty());
    }
}
